//
//  Card_Game.h
//  Card

#import <Foundation/Foundation.h>

#import "cocos2d.h"
#import <AVFoundation/AVFoundation.h>

#define CARD_MOVE_STEP 15

typedef enum
{
	MUSIC_MIN=0x00,
	MUSIC_FANPAI,
}Music_Index;

typedef enum
{
	CARD_GAME_PLAYER = 0x1000,
	CARD_GAME_SP_CARD,
	CARD_GAME_SP_COUNT_DOWN,
	CARD_GAME_SP_SELECTED_OK
}CARD_GAME_TAG;

typedef enum 
{
	ECard_Game_Next,  //下一步
	ECard_Game_Return,//返回
	ECard_Game_Des,   //帮助
	ECard_Game_Count
}ECard_Game;

@protocol Card_GameDelegate

- (void)Card_GameSelected:(NSInteger)pIndex;

@end

@interface RecordItem : UIView
{
	UIImageView * RecordBg;
	UIImageView * RecordFlag;
	UILabel     * RecordPlayer;
	UIImageView * RecordNum;
	
	UIImageView * RecordTextPoint;
}

- (id)initRecord:(NSString *)pName 
	  RecordFlag:(NSString *)pRecordFlag
	   RecordNum:(NSString *)pRecordNum
		   frame:(CGRect)pFrame;

@end

@interface Card_Game : CCLayer <ReplaceLayerActionDelegate,AVAudioPlayerDelegate>
{
	id<Card_GameDelegate> delegate;
	
	//CCSprite *spCountDown;
	//CCSprite *spCountDown1;   //个位
	CCSprite *spCard;
	CCSprite *spImage;
	BOOL isStart; //是否开始切换
	int posX;
	
	CCSprite *spNextCard;
	CCSprite *spCountBg; //倒计时背景按钮
	CCLabelTTF *labelCountNum;
	
	//CCMenu *menuCardBack;    //card背面
	BOOL isCardBack;
	int nCurCardNum;
	
	CCSprite *bottomBg;
	CCMenu *mn;
	
	CCLabelTTF *labelPlayer; //当前玩家
	//CCMenuItem *selectedMenu;
	CCMenuItemImage *selectedMenu;
	
	int nLeftSeconds; //剩下的时间
	
	BOOL isGameOver;
	BOOL isResultView;
	
	int nCurPlayer;  //当前玩家
	int nTotalPlayer; //玩家数
	NSMutableArray *cardArray;    //纸牌数组
	NSMutableArray *playerNameArray;
	NSMutableArray *scoreArray;
	
	//NSDictionary *playerInfo;
	
	UIScrollView * m_pScrollView;
}

@property (nonatomic,assign) int nTotalPlayer;

+(CCScene *) scene;

-(id)init:(id<Card_GameDelegate>) _delegate;

//确认选择
-(void)OnSelectedOK:(id)sender;
-(void)startSelectCard;

//检查精灵是否被触摸
-(BOOL)isSpriteTouched:(UITouch *)touch tag:(uint)tagSprite;
//改变精灵的图片,不能改变大小
-(void)spriteSetTexture:(CCSprite * )sp ImageFile:(NSString * )imageName;

//开始游戏
-(void)startPlayer;
//
-(void)nextCard;
//游戏结束
-(void)gameOver;

//获取玩家信息
-(void)getPlayerInfo;

//点击切换效果
-(void)leftIn;

@end
